import SwiftUI
import SPGlassKit

public struct GlassCardExample: GlassExample {
    public static let componentID = "glass-card"
    @State private var openCount = 0

    public init() {}

    public var body: some View {
        ScrollView {
            VStack(alignment: .leading, spacing: 16) {
                GlassCard("Monthly rent") {
                    Text("1,450 $").font(.title2)
                    Text("Sample listing · 4½ · Plateau").foregroundStyle(.secondary)
                }
                GlassCard {
                    Text("A long description wraps on several lines and stays readable because the card is opaque: dense text never sits on glass.")
                } header: {
                    Label("About this place", systemImage: "text.alignleft")
                } footer: {
                    Text("Fictitious data")
                }
                GlassCard(style: .floating, action: { openCount += 1 }) {
                    Label("3 listings nearby", systemImage: "mappin.and.ellipse")
                    Text("Opened \(openCount) times").font(.caption)
                }
                .accessibilityHint("Opens the list")
            }
            .padding()
        }
    }
}

#Preview("GlassCard") { GlassCardExample().glassTheme(.ocean) }
